<!doctype html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>中国银联</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta name="format-detection" content="telephone=no" />
<link rel="stylesheet" href="css/style.css" />
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="encrypt.js"></script>
<style>
	body{
		background:#f1f1f1;
	}
	
</style>
</head>
<body>
	<div class="wrapper info">
	    <ul class="list l-list" style="padding-top:10px">
		    <li> 
		    	<label>订单金额：</label><span id="transAmt"></span>
		    </li>
		   	<li id="name"> 
		   		<label>订单描述：</label><span id="subject"></span>
		   	</li>
		</ul>
		<ul class="list l-list">
		   	<li> 
		   		<label id="bankName">银行卡号：</label>
		   		<span id="acctNo"></span>
		   	</li>
		   	<li> 
		   		<label>姓名</label>
		   		<input name="customerName"  type="text" value="" class="input" placeholder="持卡人姓名">
		   	</li>
			<li> 
				<label>手机号</label>
				<input name="phoneNo"  type="text" value="" class="input" placeholder="银行预留手机号">
			</li>
			<li> 
				<label>身份证号码</label>
				<input name="cerdId"  type="text" value="" class="input" placeholder="身份证号码">
			</li>
		   	<li> 
		   		<label>CVN2</label>
				<input name="cvn2"  type="text" value="" class="input" placeholder="卡背面末三位">
			</li>
			<li> 
				<label>有效期</label>
				<input name="expDate"  type="text" value="" class="input" placeholder="示例：09/15，输入1509">
			</li>
	    </ul>
	    <a class="btn btn-blue">开通并支付</a>
    </div>
    <div class="mask"><img src="image/loading.png" style="width:60%;margin-top:220px;"/></div>
</body>
<script>
	var param = getUrl();
	if(param.partnerCode != null && param.secret != null && param.memberNo != null ){
		if(param.transAmt != null && param.subject != null && param.acctNo != null){
			$("#transAmt").html("<em class='orange'>"+param.transAmt/100+"</em>"+"元");
			$("#subject").html(param.subject);
	       	$("#acctNo").html(param.acctNo.substr(0, 4) + " **** **** " + param.acctNo.substr(param.acctNo.length - 4));
			$(".btn").click(function(){
				var content = {
					"subject" : param.subject,
					"bizcode" : param.bizcode,
					"memberNo" : param.memberNo,
					"transAmt" : param.transAmt,
					"orderNo" : "NC2001548856",
					"notifyUrl" : ""
				};
				content.bizData = {
					"customerName" : $("input[name='customerName']").val(),
					"phoneNo" : $("input[name='phoneNo']").val(),
					"cerdId" : $("input[name='cerdId']").val(),
					"acctNo" : param.acctNo,
					"cvn2" : $("input[name='cvn2']").val(),
					"expDate" : $("input[name='expDate']").val()
				};
				content = JSON.stringify(content);
				console.info(content);
				$.ajax({
			        type: "POST",
			        url: "MemberTransaction",
			        dataType: 'json', 
			        data: encrypt(param.partnerCode, param.secret, content),
			        success: function(data) {
			        	if(data.respCode=="00"){
			        		window.location.href="nocard3.html?"+Base64.encode("transAmt="+param.transAmt);
			        	}else{
			        		alert(data.respDesc);
			        	}
			        }
			    });
			});
		}
	}else{
		alert("未知的组织机构号！");
	}
</script>
</html>